<?php

/*
|--------------------------------------------------------------------------
| API 路由定义
|--------------------------------------------------------------------------
|
| 在这里定义API路由，为了方便阅读，建议使用apiResource定义资源路由组，并对一类
| 业务路由进行分组管理！
|
*/

Route::group(['namespace' => 'Finance','middleware' => 'auth:user,admin'],function(){
    Route::apiResource('finance','FinanceController');
    Route::get('financeReport','FinanceController@financeReport');
});

Route::group(['namespace' => 'Salary','middleware' => 'auth:user,admin'],function(){
    Route::apiResource('salary','SalaryController');
});

/**
 * 财务管理路由
 */
Route::group(['namespace' => 'Finance', 'middleware' => 'auth:user'], function () {
	Route::apiResource('pattern', 'PatternController');
	Route::apiResource('field', 'FieldController');
	Route::get('original', 'OriginalController@index');
	Route::apiResource('regulation', 'RegulationController');
	Route::get('template', 'TemplateController@index');
	Route::post('template', 'TemplateController@store');
	Route::get('template/{template}', 'TemplateController@show');
	Route::delete('template/{template}', 'TemplateController@destroy');
	Route::delete('condition/{condition}', 'ConditionController@destroy');
});

/**
 * 学习资料路由
 */
Route::group(['namespace'=>'Study','middleware' => 'auth:user,admin'],function(){
    Route::apiResource('study','StudyController');
    Route::post('record/{study}','StudyController@record');
    Route::get('read','StudyController@read');
    Route::get('count','StudyController@StudyCount');
    Route::get('countDetail/{project}','StudyController@CountDetail');
});

/**
 * 优秀榜
 */
Route::group(['middleware'=>'auth:user,admin'],function(){
    Route::get('excellent','ExcellentController@list');
});

/**
 * 操作日志查看
 */
Route::group(['namespace'=>'system','middleware'=>'auth:user,admin'],function(){
    Route::get('showLogs','LogController@showLogs');
});
